<?php
    header("Access-Control-Allow-Origin: *"); // 允许跨域的地址，* 表示全部
    header("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS"); // 允许的请求方法
    header("Access-Control-Allow-Headers: version, access-token, user-token"); // 允许的请求头属性

    //有没有登录就看有没有session
    //开启session
    session_start();

    if( isset( $_SESSION['userInfo'] ) ){
        //拿到userInfo里存的值
        $userInfo = $_SESSION['userInfo'];
        
        $arr = [
            "type" => 'ok',
            "message" => $userInfo
        ];
        
    }else{

        $arr = [
            "type" => 'fail',
        ];
    }
    echo json_encode($arr,JSON_UNESCAPED_UNICODE);
?>